CountAppFiles
short *doWhat ; receives action code: 0=open, 1=print
short *fileCnt ; receives number of files to process
Finder. This is the first step in determining which file or files the user wants
you to process and what the user wants you to do with it (them).
doWhat is the address of a short. Upon return, it contains one of the
following action codes ( defined in SegmentLdr.h):
appOpen 0 Open the file(s)
appPrint 1 Print the file(s)
fileCnt is the address of a short. Upon return, it contains the number of
files the user selected in the Finder before selecting Open or Print.
If the user double-clicked a document, fileCnt will return containing
a 1.
Notes: After initializing the various managers, most applications will want to
follow these steps to determine what files the user wishes to open or print:
Otherwise...
information to open or print each file. If you can't or don't want to process
• After opening or printing the file, call ClrAppFiles with the same index. This system lets a user open one or more documents automatically.
Example
#include <SegLoad.h>
#include
short fileCnt, doWhat, index;
char *cp = (char *)&fileStuff.ftype; /* ease handling of file type */
for (index = 1; index <= fileCnt; index++ ) {
/* --- normally you'd open or print the file here ---
*/
PtoCstr( fileStuff.fName ); [TOKEN:12074] convert p-string for printf */
printf("Index: %d, Type: '%c%c%c%c'; name: '%s' \n",
index, cp[0],cp[1],cp[2],cp[3], fileStuff.fName );
}